package org.makcro.sms.services.chat.base.dao;

import java.util.List;

import javax.persistence.EntityManager;
import javax.persistence.NoResultException;
import javax.persistence.PersistenceContext;

import org.makcro.sms.services.chat.model.Template;

public class TemplateDAO extends AbstractDAO<Template> implements TemplateDao {

	@PersistenceContext
	private EntityManager em;
	
	public TemplateDAO() {
		super(Template.class);
	}

	@SuppressWarnings("unchecked")
	public List<Template> findAll() {
		List<Template> sq = null;
		try {
			sq = (List<Template>) em.createNamedQuery("Template.findAll").getResultList();
		} catch (NoResultException e) {

		}

		return sq;
	}
	
	/* (non-Javadoc)
	 * @see org.makcro.sms.services.chat.base.dao.TemplateDao#findAllActive()
	 */
	@Override
	@SuppressWarnings("unchecked")
	public List<Template> findAllActive() {
		List<Template> sq = null;
		try {
			sq = (List<Template>) em.createNamedQuery("Template.findAllActive").getResultList();
		} catch (NoResultException e) {

		}

		return sq;
	}
}
